package com.yazi.mxz.common.db.dao.impl;



import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.yazi.mxz.common.db.dao.AdminDao;
import com.yazi.mxz.common.entity.beans.Admin;

import com.myframework.smhj.hibernate.dao.BasicDao;

@Repository("adminDao")
public class AdminDaoImpl extends BasicDao<Admin> implements AdminDao {

	
	public AdminDaoImpl() {
		super(Admin.class);
		
	}

	@Override
	public Criteria getExample(Admin admin, String searchWord) {
		Criteria c = super.getExample(admin, searchWord);

		// ...关联对象条件
		
		//关键字查询
		if (null != searchWord && !searchWord.isEmpty()) {
			String likeWord = "%" + searchWord + "%";
			c.add(Restrictions.or(Restrictions.like("name", likeWord),
					Restrictions.or(Restrictions.like("realName", likeWord))));
		}
		
		return c;
	}

}
